<template>
    <fieldset>
        <legend>子组件</legend>
        <h1>{{msg}}</h1>
        <h2>来自于父组件的礼物:{{gift}}</h2>
        <button @click="handleClick">点击</button>
    </fieldset>
</template>

<script>
export default {
    data() {
        return {
            msg:"这是一个字组件",
            gift2:"vue从入门到放弃"
        }
    },
    methods: {
        handleClick() {
            this.$emit('rec',this.gift2)
        }
        
    },
    mounted() {
        this.$bus.$on("bro", input => {
            console.log(input);
        })
    },
    props: {
        gift: {
            type:String,
            required: true
        }
    }
}
</script>
<style scoped>
    h1 {
        color: aqua;
    }
</style>